<template>
  <div id="get_coupon">
    <c-title :hide="false" :text="'红包分享'">
    </c-title>
    <div id="get_content">
      <div class="banner">
          <img :src="banner" />
      </div>
      <div class="coupon-info">
        <div class="coupon-get" >
          <!-- 领取 -->
          <div class="coupon-ticket" v-if="status == 'YES'">
            <div class="coupon-bg"></div>
            <div class="info-msg flex">
              <div class="left">
                <h3>{{coupon.coupon_method == 1?`${$i18n.t('money')}${coupon.deduct}`:`${coupon.discount}折`}}</h3>
                <p>满{{coupon.enough}}立减</p>
              </div>
              <div class="wrap">
                <h1 class="pl">{{coupon.name}}</h1>
                <p>有效期：{{coupon.time_start}}-{{coupon.time_end}}</p>
              </div>
              <div class="msg-circle"></div>
              <div class="msg-circle2"></div>
            </div>
            <div class="info-desc">{{coupon.api_limit}}</div>
          </div>
          <!-- 不可领和已抢光 -->
          <div class="coupon-noTick" v-if="status == 'RT'">
            <div class="coupon-bg"></div>
            <div class="title">{{msg}}</div>
          </div>
          <div class="coupon-btn" @click="goHome">{{status == "YES"?"立即使用":"看看其它活动"}}</div>
          <div class="pay-user">{{status == "YES"?`红包已放入账号：${name}`:`领券账号：${name}`}}</div>
        </div>
      </div>
        <div class="get_list">
            <p class="pack_number">还剩{{max_num}}个红包</p>
            <div class="red_pack">
              <van-pull-refresh v-model="isLoading" @refresh="getMoreRecord" :disabled="isAllLoaded">
                <div class="list" v-for="(item,i) in record_arr" :key='i'>
                    <div class="user">
                        <img :src="item.receive_member.avatar">
                    </div>
                    <ul class="user_info">
                        <li class="name"><span class="name_a">{{item.receive_member.nickname}}</span><span class="name_b">{{item.remark}}</span></li>
                        <li class="time">{{item.created_at}}</li>
                    </ul>
                </div>
              </van-pull-refresh>
            </div>
        </div>
        <div class="mb50"></div>
    </div>
  </div>
</template>

<script>
import get_coupon_controller from "./get_coupon_controller";

export default get_coupon_controller;
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
/* 单行文本的溢出显示省略号 */
.pl {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mb50 {
  height: 3.125rem;
  clear: both;
}
#get_coupon {
  #get_content {
    //新样式
    .banner {
      width: 100%;
      overflow: hidden;
      img {
        max-width: 100%;
        width: 100%;
        height: auto;
        display: block;
      }
    }
    .coupon-info {
      margin: 0.8125rem 0.75rem 0 0.75rem;
      .coupon-get {
        background: #FFFFFF;
        border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
        padding:0.75rem;
      }
      .coupon-ticket {
        position: relative;
        .coupon-bg {
          width: 100%;
          height: 100%;
          background: var(--themeBaseColor);
          opacity: 0.08;
          position:absolute;
          z-index: 0;
          top:0;
          left:0;
          border-radius: 0.625rem;
        }
        border-radius: 0.625rem;
        .info-msg {
          padding:0.6875rem 0 0.6875rem 0;
          position: relative;
          .left {
            width:38%;
            padding: 0  0 0  14px;
            text-align: left;
            h3 {
              font-size: 1.3125rem;
              font-weight: bold;
              color: var(--themeBaseColor);
              span {
                font-size: 0.9375rem;
              }
            }
            p {
              font-size: 0.75rem;
              padding:1px 0 0 0;
              font-weight: 400;
              color: var(--themeBaseColor);
            }
          }
          .wrap {
            width:62%;
            box-sizing: border-box;
            padding:0 25px 0 0;
            text-align: left;
            h1 {
              font-size: 0.9375rem;
              font-weight: bold;
              color: #00001C;
              padding:0 0 0.5rem 0;
            }
            p {
              font-size: 0.75rem;
              font-weight: 400;
              color: #6E6E79;
            }
          }
          .msg-circle,.msg-circle2 {
            position: absolute;
            width: 0.6875rem;
            height: 0.6875rem;
            background-color: #fff;
            border-radius: 50%;
          }
          .msg-circle {
            bottom:0;
            left:0;
            transform: translate(-50%, 50%);
          }
          .msg-circle2 {
            bottom:0;
            right:0;
            transform: translate(50%, 50%);
          }
        }
        .info-desc {
          margin:0 14px;
          text-align: left;
          border-top:0.0625rem dashed var(--themeBaseColor);
          padding:0.375rem 0 0.5rem 0rem;
          font-size: 0.75rem;
          color: #6E6E79;
        }
      }
      .coupon-btn {
        margin:1.5625rem 0 0 0;
        font-size: 0.9375rem;
        line-height: 0.9375rem;
        font-weight: 500;
        color: #FFFFFF;
        background: var(--themeBaseColor);
        border-radius: 1.25rem;
        padding: 0.8125rem 0;
      }
      .pay-user {
        padding:0.5rem 0 0 0;
        font-size: 0.75rem;
        font-weight: 400;
        color: #6E6E79;
      }

      .coupon-noTick {
        border-radius: 0.625rem;
        position: relative;
        padding:2.6875rem 0;
        
        .coupon-bg {
          width: 100%;
          height: 100%;
          background: var(--themeBaseColor);
          opacity: 0.08;
          position:absolute;
          z-index: 0;
          top:0;
          left:0;
          border-radius: 0.625rem;
        }
        .title {
          font-size: 0.9375rem;
          color: #6E6E79;
          position: relative;
          display: inline-block;
          &::after {
            content: '';
            width:1.875rem;
            height: 0.0625rem;
            position: absolute;
            background-color: #AAAAB3;
            top:50%;
            right:-3.5rem;
          }
          &::before {
            content: '';
            width:1.875rem;
            height: 0.0625rem;
            position: absolute;
            background-color: #AAAAB3;
            top:50%;
            left:-3.5rem;
          }
        }
      }
    }
    .get_list {
      margin: 0.625rem 0.75rem 0 0.75rem;
      background: #fff;
      border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
      padding:0 0.75rem;
      .pack_number {
        line-height: 1.875rem;
        font-size: 0.875rem;
        padding: 0 0.625rem;
        color: #8c8c8c;
        border-radius: 0.125rem;
        text-align: left;
        border-bottom: 0.0625rem solid #F5F5F5;
      }

      .red_pack {
        .list {
          display: flex;
          padding: 0.625rem 0;
          .user {
            width: 2.5rem;
            height: 2.5rem;
            border-radius: 50%;
            // overflow: hidden;
            background: #faf5f5;
            margin-right: 0.625rem;
            img {
              width: 100%;
              max-width: 100%;
              height: auto;
              border-radius: 50%;
            }
          }
          .user_info {
            width: 19.1875rem;
            .name {
              line-height: 1.25rem;
              display: flex;
              justify-content: space-between;

              .name_a {
                font-size: 0.9375rem;
                max-width: 13.75rem;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              }

              .name_b {
                color: #f15353;
                font-size: 0.875rem;
              }
            }
            .time {
              line-height: 1.25rem;
              color: #8c8c8c;
              font-size: 0.75rem;
              text-align: left;
            }
          }
        }
      }
    }
  }
}
</style>
